package CH5;

/**
 * Created by Cai Ye on 2016/3/31.
 */

import java.util.HashMap;
import java.util.Map;

public class MapKeyValue2 {
    public static void main(String[] args) {
        Map<String, String> map = new HashMap<>();
        map.put("one", "一");
        map.put("two", "二");
        map.put("three", "三");
        foreach(map.entrySet());
    }

    static void foreach(Iterable<Map.Entry<String, String>> iterable) {
        for (Map.Entry<String, String> entry : iterable) {
            System.out.printf("(键 %s, 值 %s)%n", entry.getKey(), entry.getValue());
        }
    }
}
